/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pb138.videodes.desktop;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.AbstractListModel;

/**
 *
 * @author vaclav
 */
public class ActorListModel extends AbstractListModel {

    List<String> actors = new ArrayList<String>();

    public void add(String actor) {
        actors.add(actor);

        int row = actors.size();
        fireIntervalAdded(this, row, row);
    }

    public void remove(String actor) {
        actors.remove(actor);

        int row = actors.size();
        fireIntervalRemoved(this, row, row);
    }
    
    public List<String> getAllActors() {
        return Collections.unmodifiableList(actors);
    }

    @Override
    public int getSize() {
        return actors.size();
    }

    @Override
    public Object getElementAt(int i) {
        return actors.get(i);
    }
}
